package com.tensquare.base.client.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.tensquare.base.client.GatheringClient;
import com.tensquare.base.domain.Gathering;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * ------------------------------
 * 功能：
 * 作者：WF
 * 微信：hbxfwf13590332912
 * 创建时间：2021/9/1-14:44
 * ------------------------------
 */
@Component
public class GatheringClientFactory implements FallbackFactory<GatheringClient> {
    @Override
    public GatheringClient create(Throwable cause) {
        return new GatheringClient() {
            @Override
            public AjaxResult findAll() {
                return null;
            }

            @Override
            public AjaxResult findById2(String id) {
                System.out.println("查看单个活动出现问题了[factory]。。。");
                Map<String,String> errors= new HashMap<>();
                errors.put("msg","查看单个活动出现问题了[factory]");
                return AjaxResult.success(errors);
            }

            @Override
            public AjaxResult add2(Gathering gathering) {
                return null;
            }
        };
    }
}
